<?php
class Page_Block_Form extends Core_Block_Template {

	protected $_formData = null;
	
	public function getFormData() {
		if ($this->_formData === null) {
			$this->_formData = is_array(Mag::registry('form_data')) ? Mag::registry('form_data') : array();
		}
		return $this->_formData;
	}
	
	public function setFormData(array $data) {
		$this->_formData = $data;
	}

	public function getValue($field) {
		$data = $this->getFormData();
		return isset($data[$field]) ? $data[$field] : null;
	}

	public function getSelect($field, $value) {
		return $this->getValue($field) == $value ? ' selected="selected' : '';
	}

	public function getCheck($field, $value) {
		return $this->getValue($field) == $value ? ' checked="checked' : '';
	}
}

